From cace9ffaef43f54db0ab55f6c440a630aa4f7748 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Mon, 22 Apr 2019 07:17:18 -0600 Subject: [PATCH] hook GUI up to sort filter. (#342) because the sort filter now works on waypoints and/or routes and/or tracks the dialog is under the Miscellaneous menu. --- gui/filterdata.cc | 19 ++ gui/filterdata.h | 21 ++- gui/filterwidgets.cc | 10 +- gui/miscfltui.ui | 438 ++++++++++++++++++++++++++++--------------- gui/wayptsui.ui | 237 +++++++++++------------ 5 files changed, 449 insertions(+), 276 deletions(-) diff --git a/gui/filterdata.cc b/gui/filterdata.cc index 5652c8fea..db987d8ba 100644 --- a/gui/filterdata.cc +++ b/gui/filterdata.cc @@ -210,5 +210,24 @@ QStringList MiscFltFilterData::makeOptionString() } args << s; } + + if (sortWpt_ || sortRte_ || sortTrk_) { + args << "-x"; + QString s = "sort"; + if (sortWpt_) { + const QStringList wptopts= {"description", "gcid", "shortname", "time"}; + s += QString(",%1").arg(wptopts.at(sortWptBy_)); + } + if (sortRte_) { + const QStringList rteopts= {"rtedesc", "rtename", "rtenum"}; + s += QString(",%1").arg(rteopts.at(sortRteBy_)); + } + if (sortTrk_) { + const QStringList trkopts= {"trkdesc", "trkname", "trknum"}; + s += QString(",%1").arg(trkopts.at(sortTrkBy_)); + } + args << s; + + } return args; } diff --git a/gui/filterdata.h b/gui/filterdata.h index 5aada4ebd..44ebe53eb 100644 --- a/gui/filterdata.h +++ b/gui/filterdata.h @@ -137,7 +137,7 @@ class WayPtsFilterData: public FilterData public: WayPtsFilterData(): FilterData(), duplicates(false), shortNames(true), locations(false), - position(false), radius(false), sort(false), + position(false), radius(false), positionVal(0.0), radiusVal(0.0), longVal(0.0), latVal(0.0), positionUnit(0), radiusUnit(0) @@ -159,12 +159,11 @@ public: sg.addVarSetting(new BoolSetting("wpts.position", position)); sg.addVarSetting(new DoubleSetting("wpts.positionVal", positionVal)); sg.addVarSetting(new IntSetting("wpts.positionUnit", positionUnit)); - sg.addVarSetting(new BoolSetting("wpts.sort", sort)); } public: - bool duplicates, shortNames, locations, position, radius, sort; + bool duplicates, shortNames, locations, position, radius; double positionVal; double radiusVal; double longVal, latVal; @@ -207,7 +206,13 @@ public: transform_(false), del_(false), swap_(false), - transformVal_(0) + sortWpt_(false), + sortRte_(false), + sortTrk_(false), + transformVal_(0), + sortWptBy_(0), + sortRteBy_(0), + sortTrkBy_(0) { } @@ -222,12 +227,20 @@ public: sg.addVarSetting(new IntSetting("mscflt.transformVal", transformVal_)); sg.addVarSetting(new BoolSetting("mscflt.delete", del_)); sg.addVarSetting(new BoolSetting("mscflt.swap", swap_)); + sg.addVarSetting(new BoolSetting("mscflt.sortWpt", sortWpt_)); + sg.addVarSetting(new IntSetting("mscflt.sortWptBy", sortWptBy_)); + sg.addVarSetting(new BoolSetting("mscflt.sortRte", sortRte_)); + sg.addVarSetting(new IntSetting("mscflt.sortRteBy", sortRteBy_)); + sg.addVarSetting(new BoolSetting("mscflt.sortTrk", sortTrk_)); + sg.addVarSetting(new IntSetting("mscflt.sortTrkBy", sortTrkBy_)); } public: bool nukeRoutes_, nukeTracks_, nukeWaypoints_; bool transform_, del_, swap_; + bool sortWpt_, sortRte_, sortTrk_; int transformVal_; + int sortWptBy_, sortRteBy_, sortTrkBy_; }; diff --git a/gui/filterwidgets.cc b/gui/filterwidgets.cc index 3cd78f42f..930bbd246 100644 --- a/gui/filterwidgets.cc +++ b/gui/filterwidgets.cc @@ -174,7 +174,6 @@ WayPtsWidget::WayPtsWidget(QWidget* parent, WayPtsFilterData& wfd): FilterWidget fopts << new BoolFilterOption(wfd.locations, ui.locationsCheck); fopts << new BoolFilterOption(wfd.position, ui.positionCheck); fopts << new BoolFilterOption(wfd.radius, ui.radiusCheck); - fopts << new BoolFilterOption(wfd.sort, ui.sortCheck); fopts << new DoubleFilterOption(wfd.positionVal, ui.positionText, 0.0, 1.0E308); fopts << new DoubleFilterOption(wfd.radiusVal, ui.radiusText, 0.0, 1.0E308); fopts << new DoubleFilterOption(wfd.longVal, ui.longText, -180, 180, 7, 'f'); @@ -230,6 +229,9 @@ MiscFltWidget::MiscFltWidget(QWidget* parent, MiscFltFilterData& mfd): FilterWid ui.transformCombo->addItem(QString("%1 %2 %3").arg(tr("Waypoints")).arg(QChar(8594)).arg(tr("Tracks"))); addCheckEnabler(ui.transformCheck, QList() << ui.transformCombo << ui.deleteCheck); + addCheckEnabler(ui.sortWptCheck, ui.sortWptBy); + addCheckEnabler(ui.sortRteCheck, ui.sortRteBy); + addCheckEnabler(ui.sortTrkCheck, ui.sortTrkBy); fopts << new BoolFilterOption(mfd.transform_, ui.transformCheck); fopts << new BoolFilterOption(mfd.swap_, ui.swapCheck); @@ -237,7 +239,13 @@ MiscFltWidget::MiscFltWidget(QWidget* parent, MiscFltFilterData& mfd): FilterWid fopts << new BoolFilterOption(mfd.nukeTracks_, ui.nukeTracks); fopts << new BoolFilterOption(mfd.nukeRoutes_, ui.nukeRoutes); fopts << new BoolFilterOption(mfd.nukeWaypoints_, ui.nukeWaypoints); + fopts << new BoolFilterOption(mfd.sortWpt_, ui.sortWptCheck); + fopts << new BoolFilterOption(mfd.sortRte_, ui.sortRteCheck); + fopts << new BoolFilterOption(mfd.sortTrk_, ui.sortTrkCheck); fopts << new ComboFilterOption(mfd.transformVal_, ui.transformCombo); + fopts << new ComboFilterOption(mfd.sortWptBy_, ui.sortWptBy); + fopts << new ComboFilterOption(mfd.sortRteBy_, ui.sortRteBy); + fopts << new ComboFilterOption(mfd.sortTrkBy_, ui.sortTrkBy); setWidgetValues(); checkChecks(); diff --git a/gui/miscfltui.ui b/gui/miscfltui.ui index 996fc4641..d7e24d6f2 100644 --- a/gui/miscfltui.ui +++ b/gui/miscfltui.ui @@ -1,146 +1,292 @@ - - - MiscFltWidget - - - - 0 - 0 - 303 - 175 - - - - Form - - - - - - - 11 - 75 - true - - - - Misc. Filters - - - - - - - Nuke (Remove) Data Types - - - - 4 - - - 4 - - - - - Routes - - - - - - - Tracks - - - - - - - Waypoints - - - - - - - - - - - - Convert routes, waypoints and tracks to different types. - - - This filter can be used to convert GPS data between different data types. - -Some GPS data formats support only some subset of waypoints, tracks, and routes. The transform filter allows you to convert between these types. For example, it can be used to convert a pile of waypoints (such as those from a CSV file) into a track or vice versa. - - - Transform - - - - - - - Type of transformation. - - - - - - - Delete original data after transform to prevent duplicated data. - - - Delete - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Swap Longitude and Latitudes for badly formatted data formats. - - - Simple filter to swap the coordinate values (latitude and longitude) of all points. This can be helpful for wrong defined/coded data. Or if you think, you can use one of our xcsv formats, but latitude and longitude are in opposite order. - - - Swap Coordinates - - - - - - - Qt::Vertical - - - - 20 - 1 - - - - - - - - - + + + MiscFltWidget + + + + 0 + 0 + 310 + 250 + + + + Form + + + + + + + + Sort Routes + + + + + + + + + Convert routes, waypoints and tracks to different types. + + + This filter can be used to convert GPS data between different data types. + +Some GPS data formats support only some subset of waypoints, tracks, and routes. The transform filter allows you to convert between these types. For example, it can be used to convert a pile of waypoints (such as those from a CSV file) into a track or vice versa. + + + Transform + + + + + + + Type of transformation. + + + + + + + Delete original data after transform to prevent duplicated data. + + + Delete + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Nuke (Remove) Data Types + + + + 4 + + + 4 + + + + + Routes + + + + + + + Tracks + + + + + + + Waypoints + + + + + + + + + + + + By + + + + + + + + Description + + + + + GCID + + + + + Name + + + + + Time + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Sort Waypoints + + + + + + + + + By + + + + + + + + Description + + + + + Name + + + + + Number + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Swap Longitude and Latitudes for badly formatted data formats. + + + Simple filter to swap the coordinate values (latitude and longitude) of all points. This can be helpful for wrong defined/coded data. Or if you think, you can use one of our xcsv formats, but latitude and longitude are in opposite order. + + + Swap Coordinates + + + + + + + + 11 + 75 + true + + + + Misc. Filters + + + + + + + Sort Tracks + + + + + + + + + By + + + + + + + + Description + + + + + Name + + + + + Number + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + diff --git a/gui/wayptsui.ui b/gui/wayptsui.ui index 51bab7ee1..de35ea3a1 100644 --- a/gui/wayptsui.ui +++ b/gui/wayptsui.ui @@ -6,8 +6,8 @@ 0 0 - 523 - 195 + 466 + 173 @@ -16,72 +16,18 @@ - - - - - 11 - 75 - true - - - - Waypoints Filters - - - - - - - Remove duplicates - - - The duplicate filter is designed to remove duplicate points based on their short name (traditionally a waypoint's name on the GPS receiver), and/or their location (to a precision of 6 decimals). This filter supports two options that specify how duplicates will be recognized, shortname and location. Generally, at least one of these options is required. - - - Duplicates - - - - - - - - 0 - 0 - - - - Suppress duplicate waypoints based on name. - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Suppress duplicate waypoints based on name. </p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option is the one most often used with the duplicate filter. This option instructs the duplicate filter to remove any waypoints that share a short name with a waypoint that has come before. This option might be used to remove duplicates if you are merging two datasets that were each created in part from a common ancestor dataset. </p></body></html> - - - Short Names - - - - - + + - Suppress duplicate waypoint based on coords. + Include points only within radius - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Suppress duplicate waypoint based on coords. </p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option causes the duplicate filter to remove any additional waypoint that has the same coordinates (to six decimal degrees) as a waypoint that came before. This option may be used to remove duplicate waypoints if the names are not expected to be the same. It also might be used along with the <span style=" font-family:'Courier New,courier';">shortname</span> option to remove duplicate waypoints if the names of several unrelated groups of waypoints might be the same. </p></body></html> + This filter includes or excludes waypoints based on their proximity to a central point. All waypoints more than the specified distance from the specified point will be removed from the dataset. + +By default, all remaining points are sorted so that points closer to the center appear earlier in the output file. - Locations + Radius @@ -100,50 +46,69 @@ This option specifies the minimum allowable distance between two points. If two - - - + + + + Lat. + + + + + + - 80 - 16777215 + 110 + 0 - Maximum positional distance. + Latitude of the central point in decimal degrees. South latitudes should be expressed as a negative number. - - + + - Feet + Miles - Meters + km - - - - Include points only within radius - - - This filter includes or excludes waypoints based on their proximity to a central point. All waypoints more than the specified distance from the specified point will be removed from the dataset. - -By default, all remaining points are sorted so that points closer to the center appear earlier in the output file. + + + + + 11 + 75 + true + - Radius + Waypoints Filters - - + + + + + 110 + 0 + + + + Longitude of the central point in decimal degrees. West longitudes should be expressed as a negative number. + + + + + 80 @@ -151,74 +116,96 @@ By default, all remaining points are sorted so that points closer to the center - Maximum distance from center. + Maximum positional distance. - - + + + + Long. + + + + + + + Suppress duplicate waypoint based on coords. + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Suppress duplicate waypoint based on coords. </p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option causes the duplicate filter to remove any additional waypoint that has the same coordinates (to six decimal degrees) as a waypoint that came before. This option may be used to remove duplicate waypoints if the names are not expected to be the same. It also might be used along with the <span style=" font-family:'Courier New,courier';">shortname</span> option to remove duplicate waypoints if the names of several unrelated groups of waypoints might be the same. </p></body></html> + + + Locations + + + + + - Miles + Feet - km + Meters - - + + + + Remove duplicates + + + The duplicate filter is designed to remove duplicate points based on their short name (traditionally a waypoint's name on the GPS receiver), and/or their location (to a precision of 6 decimals). This filter supports two options that specify how duplicates will be recognized, shortname and location. Generally, at least one of these options is required. + - Lat. + Duplicates - - - - - 110 - 0 - + + + + + 0 + 0 + - Latitude of the central point in decimal degrees. South latitudes should be expressed as a negative number. + Suppress duplicate waypoints based on name. + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Suppress duplicate waypoints based on name. </p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option is the one most often used with the duplicate filter. This option instructs the duplicate filter to remove any waypoints that share a short name with a waypoint that has come before. This option might be used to remove duplicates if you are merging two datasets that were each created in part from a common ancestor dataset. </p></body></html> - - - - - Long. + Short Names - - - + + + - 110 - 0 + 80 + 16777215 - Longitude of the central point in decimal degrees. West longitudes should be expressed as a negative number. - - - - - - - This filter sorts waypoints into alphabetical order - - - This filter sorts waypoints into alphabetical order - - - Sort + Maximum distance from center. -- 2.30.2